package controllers.tinkerforge;

import java.util.ArrayList;

import models.NodeConfig;
import play.Logger;
import ch.bfh.abcm.rems.interfaces.tinkerforge.TFSensorDataPersister;
import ch.bfh.abcm.rems.sensors.tinkerforge.TFConfig;
import ch.bfh.abcm.rems.sensors.tinkerforge.TFSensorConfigDefinition;
import ch.bfh.abcm.rems.sensors.tinkerforge.TFSensorType;

public class REMSTFConfig extends TFConfig{
    
    private static final String IP_NODE_1 = "192.168.10.11";
    private static final String IP_NODE_2 = "192.168.10.12";
    private static final String IP_NODE_3 = "192.168.10.14";
    
    private static final String IP_MEASUREMENT_POINT_1 = "192.168.10.31";
    private static final String IP_MEASUREMENT_POINT_2 = "192.168.10.32";
    private static final String IP_MEASUREMENT_POINT_3 = "192.168.10.33";
    private static final String IP_MEASUREMENT_POINT_4 = "192.168.10.34";

    public REMSTFConfig(TFSensorDataPersister dataPersister) {
        super(dataPersister);
        svaveNodeIps();
    }

    private void svaveNodeIps() {
        NodeConfig.deleteAll();
        new NodeConfig("Node1",IP_NODE_1).save();
        new NodeConfig("Node2",IP_NODE_2).save();
        new NodeConfig("Node3",IP_NODE_3).save();
        
    }

    @Override
    protected ArrayList<String> getMasterbrickIPs() {
        ArrayList<String> ips = new ArrayList<String>();
        ips.add(IP_MEASUREMENT_POINT_1);        
        ips.add(IP_MEASUREMENT_POINT_2);        
        ips.add(IP_MEASUREMENT_POINT_3);        
        ips.add(IP_MEASUREMENT_POINT_4);        
        return ips;
    }
}
